package org.xiaofeipapa.feimall.userApi.service;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.xiaofeipapa.feimall.common.event.UserPayEvent;

/**
 * 作者: 小肥爬爬
 * 简书: https://www.jianshu.com/u/db796a501972
 * gitee: https://gitee.com/xiaofeipapa
 * 邮箱: imyunshi@163.com
 * 您可以自由转载此博客文章, 恳请保留原链接, 谢谢!
 **/
@Component
public class UserService {

    // 在订单成功之后, 更新用户信息
    @EventListener(classes = {UserPayEvent.class})
    private String updateInfoAfterPay(UserPayEvent payEvent) throws Exception{

        // 简单打个log, 表示处理
        System.out.println("更新用户消息, 用户: " + payEvent.getUserName());
        return "更新用户成功";
    }

}
